import json
import requests
import dashscope

import cfg
from dagent_llm import LLM

model = LLM(llm_server=cfg.LLM["llm_server"])

def ask_deepseek(question,history=None,max_history=10):
    if not history:
        history = []
    if len(history) > max_history:
        history = history[-1*int(max_history):]
    system = [{"role": "system", "content": cfg.LLM["base_system"]}]
    messages = system + history + [
        {"role": "user", "content": question},
    ]
    model.history = messages
    r = model.chat(question)
    return r.content

if __name__ == '__main__':
    print(ask_deepseek("你是谁"))